# -*- coding: utf-8 -*-
from sqlalchemy import Column,String,Integer,Text,Binary,Boolean,DateTime,Enum,Float,BigInteger
from adminApp.extensions import db
from .base import BaseModel
import uuid


def gen_id():
    return uuid.uuid4().hex


class SourceAqySnmpLog(db.Model):
    '''爱奇艺的原始snmp log'''
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    # 实际发送 字节 单位 Bytes/s
    BytesSent = Column(Float)
    # 发送 字节 单位 Bytes/s
    OutBytes = Column(Float)
    # 时间 Unix 转换为时间
    Unix = Column(DateTime, index=True)

    machine_id = db.Column(db.Integer, db.ForeignKey('machine.id', ondelete='CASCADE'), nullable=False, index=True)
    machine = db.relationship('Machine', back_populates='source_aqy_snmp_logs')

    __table_args__ = (
        db.Index('ix_machineid_nictime', "machine_id", "Unix"),
        # db.UniqueConstraint('domain_id', 'book_mark', name='uix_domain_bookmark')
    )